package com.jiang.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class JSPObjectAction extends ActionSupport {

	
	@SuppressWarnings("unused")
	@Override
	public String execute() throws Exception {
		// 请实现获取请求中的上下文路径，请求内容类型，虚拟路径对应的
		// 实际映射地址， SessionID  (这样成功后就能上传文件有地址了)
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpServletResponse  response = ServletActionContext.getResponse();
		HttpSession session  =  request.getSession();
		String contextPath = request.getContextPath();
		String contentType = request.getContentType();
		String realPath = request.getServletContext().getRealPath("/");
		String sessionId = session.getId();
		System.out.println("contextPath="+contextPath+",contentType="+contentType+",realPath="+realPath+",sessionId="+sessionId);
		return SUCCESS;
	}
	
	
}
